<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,height=device-height">
  <title>TOP 5000 电影数据分析</title>
  <!-- <link href="https://fonts.googleapis.com/css?family=Ubuntu+Condensed&display=swap" rel="stylesheet"> -->
  <style>
    ::-webkit-scrollbar {
      display: none;
    }

    html,
    body {
      font-family: 'Ubuntu Condensed';
      height: 100%;
      margin: 0;
      color: rgba(0, 0, 0, 0.85);
      overflow: hidden;
    }
  </style>
</head>

<body>
  <div id="mountNode"></div>
  <script>/*Fixing iframe window.innerHeight 0 issue in Safari*/document.body.clientHeight;</script>
  <script src="static/g2.min.js"></script>
  <script src="static/data-set.min.js"></script>
  <script src="static/jquery-3.2.1.min.js"></script>
  <script>
    function generateChart(id) {
      var chart = new G2.Chart({
        container: id,
        forceFit: true,
        height: window.innerHeight
      });
      // chart.source(data);
      chart.coord('polar', {
        innerRadius: 0.2
      });
      chart.legend({
        position: 'left',
        offsetY: -window.innerHeight / 2 + 220,
        offsetX: 140
      });
      chart.axis(false);
      chart.interval().position('runtime*count').label("count").color('runtime', G2.Global.colors_pie_16).style({
        lineWidth: 1,
        stroke: '#fff'
      });
      chart.render();

      return chart;
    }
  </script>
  <script>

    let chart = generateChart('mountNode');

    window.onload = () => {
      $.getJSON("static/runtime.json", d => {
        d.forEach(v => v.runtime = `${v.runtime + " min."}`)
        chart.changeData(d)
      });
    }
  </script>
</body>

</html>